package com.coreJava.test02.xiancheng;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * 作者: LCG
 * 日期: 2019/9/4 10:57
 * 描述:
 */
public class MyPoolConcurrent {

    public static void main(String[] args) {

        ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(2);

        //延迟多久执行任务
       /* scheduledExecutorService.schedule(new Runnable() {
            @Override
            public void run() {
                System.out.println("=====执行====");
            }
        },5,TimeUnit.SECONDS);*/

        //按照固定的频率执行
        /*scheduledExecutorService.scheduleWithFixedDelay(new Runnable() {
            @Override
            public void run() {
                System.out.println("=====执行====");
            }
        },5,1,TimeUnit.SECONDS);*/

        //定长的线程池
        Executors.newFixedThreadPool(20);

        Executors.newSingleThreadScheduledExecutor();

        Executors.newCachedThreadPool();



    }

}
